package com.cn.crmsystem.controller.censusController;

import com.cn.crmsystem.pojo.Login;
import com.cn.crmsystem.pojo.ResultJson;
import com.cn.crmsystem.pojo.User;
import com.cn.crmsystem.service.censusService.SalesKitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
//from ldk
@Controller
@Api(value = "仪表盘销售简报的表单",tags = "仪表盘销售简报的表单api")
public class SalesKitContrlller {
    @Autowired
    private SalesKitService salesKitService;

    //查询今天，本月，本年的接口
    @RequestMapping(value = "/selectsaleskitcustomer" ,method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "销售表单的数据",notes = "展示八个 销售表单的数据，",
            httpMethod = "GET",
            response =ResultJson.class )
    @ApiImplicitParams({
            @ApiImplicitParam(name = "firstSelect",value = "第二个下拉框的选项：传给后端的值，写四个：nowDay,nowMonth,nowYear,2020-09-07--2020-09-08 默认值为nowDay",
                    paramType = "query",
                    dataType = "String",required =false),
            @ApiImplicitParam(name = "secondSelect",value = "第一个下拉框的选项，传给后端的值，三个：myself,myDepartment,all，默认值：myself",paramType = "query",
                    dataType = "String",required = false),
    })
    public ResultJson selectsaleskitcustomer(@RequestParam String firstSelect,@RequestParam String secondSelect){
        Login login  = (Login) SecurityUtils.getSubject().getPrincipal(); //接收user类的所有属性
        Integer user_id=login.getUser_id();

//        Integer user_id=1;
        User user=salesKitService.selectUser(user_id);

       return salesKitService.selectsaleskitcustomer(user,firstSelect,secondSelect);
    }


/**前端传给得参数:第一个下拉框:myself,myDepartment,all
 *q               第二个下拉框:nowDay,nowMonth,nowYear ,2020-09-07--2020-09-08
 */

//    @RequestMapping(value = "/selectUser" ,method = RequestMethod.GET)
//    @ResponseBody
//    public ResultJson selectUser(){
//        return salesKitService.selectUser();
//    }



}
